import BannerPlugin from '@admin/plugins/banner'
export default {
  data() {
    return {
    }
  },
  mounted() {
    BannerPlugin._setBannerContainerInstance(this.$refs.pageBanner)
  },
  computed: {
    showBanner: function () {
      return !!this.pageInfo.bannerSetting
    },
    bannerPosition: function () {
      return this.bannerSetting?.position || 'top'
    },
    bannerSetting: function () {
      try {
        return this.pageInfo.bannerSetting ? JSON.parse(this.pageInfo.bannerSetting) : {}
      } catch (error) {
        return {}
      }
    }
  },
  methods: {
    getBannerData() {
      this.$refs.pageBanner && this.$refs.pageBanner.getBannerData()
    }
  }
}
